/**
 * 表单验证规则
 */
const rules = {
	'userInfo.name': [{
		type: 'string',
		required: true,
		message: '请填写姓名',
		trigger: ['blur', 'change']
	}, {
		// 此为同步验证，可以直接返回true或者false，如果是异步验证，稍微不同，见下方说明
		validator: (rule, value, callback) => {
			// 调用uView自带的js验证规则，详见：https://www.uviewui.com/js/test.html
			return uni.$u.test.chinese(value);
		},
		message: "姓名必须为中文",
		// 触发器可以同时用blur和change，二者之间用英文逗号隔开
		trigger: ["change", "blur"],
	}],
	code: {
		type: 'string',
		required: true,
		len: 4,
		message: '请填写4位验证码',
		trigger: ['blur']
	},
	'userInfo.sex': {
		type: 'string',
		max: 1,
		required: true,
		message: '请选择男或女',
		trigger: ['blur', 'change']
	},
	radiovalue1: {
		type: 'string',
		min: 1,
		max: 2,
		message: '橙子有毒',
		trigger: ['change']
	},
	checkboxValue1: {
		type: 'array',
		min: 2,
		required: true,
		message: '不能太宅，至少选两项',
		trigger: ['change']
	},
	intro: {
		type: 'string',
		min: 3,
		required: true,
		message: '不低于3个字',
		trigger: ['change']
	},
	hotel: {
		type: 'string',
		min: 2,
		required: true,
		message: '请选择住店时间',
		trigger: ['change']
	},
	'userInfo.birthday': {
		type: 'string',
		required: true,
		message: '请选择生日',
		trigger: ['change']
	},
};

export default formRuls;